﻿using System;
using FreeSql.DataAnnotations;

namespace Colorful.Furniture.SysManagement
{
    /// <summary>
    /// 系统接口日志
    /// </summary>
    [Table(Name = "sys_api_log")]
    public class SysApiLog
    {
        /// <summary>
        ///  Id
        /// </summary>
        [Column(Name = "id", IsIdentity = true, IsPrimary = true)]
        public Guid Id { get; set; }

        /// <summary>
        ///  请求URL地址
        /// </summary>
        [Column(Name = "request_url", StringLength = 200)]
        public string RequestUrl { get; set; }

        /// <summary>
        ///  请求方式
        /// </summary>
        [Column(Name = "request_method", StringLength = 20)]
        public string RequestMethod { get; set; }

        /// <summary>
        ///  方法描述
        /// </summary>
        [Column(Name = "action_description", StringLength = 100)]
        public string ActionDescription { get; set; }

        /// <summary>
        /// 授权类型
        /// </summary>
        [Column(Name = "authorization_type")]
        public int AuthorizationType { get; set; }

        /// <summary>
        ///  区域
        /// </summary>
        [Column(Name = "area", StringLength = 20)]
        public string Area { get; set; }

        /// <summary>
        ///  控制器
        /// </summary>
        [Column(Name = "controller", StringLength = 100)]
        public string Controller { get; set; }

        /// <summary>
        ///  方法
        /// </summary>
        [Column(Name = "action", StringLength = 100)]
        public string Action { get; set; }

        /// <summary>
        ///  请求体JSON
        /// </summary>
        [Column(Name = "request_json", StringLength = -1)]
        public string RequestInput { get; set; }

        /// <summary>
        ///  是否成功
        /// </summary>
        [Column(Name = "success")]
        public bool Success { get; set; }

        /// <summary>
        ///  失败消息，当Success = true有效
        /// </summary>
        [Column(Name = "error_message", StringLength = 4000)]
        public string ErrorMessage { get; set; }

        /// <summary>
        ///  耗时
        /// </summary>
        [Column(Name = "elapsed_milliseconds")]
        public long ElapsedMilliseconds { get; set; }

        /// <summary>
        ///  备注
        /// </summary>
        [Column(Name = "remark", StringLength = 200)]
        public string Remark { get; set; }

        /// <summary>
        ///  审计体
        /// </summary>
        [Column(Name = "audit_body", StringLength = -1)]
        public string AuditBody { get; set; }

        /// <summary>
        ///  浏览器
        /// </summary>
        [Column(Name = "browser", StringLength = 200)]
        public string Browser { get; set; }

        /// <summary>
        ///  操作系统
        /// </summary>
        [Column(Name = "operation_system", StringLength = 50)]
        public string OperationSystem { get; set; }

        /// <summary>
        ///  ip地址
        /// </summary>
        [Column(Name = "ip", StringLength = 50)]
        public string Ip { get; set; }

        /// <summary>
        ///  操作者
        /// </summary>
        [Column(Name = "operator", StringLength = 50)]
        public string Operator { get; set; }

        /// <summary>
        ///  操作者编码
        /// </summary>
        [Column(Name = "operator_id")]
        public Guid? OperatorId { get; set; }

        /// <summary>
        ///  操作者类型，1：后台管理员，2：用户
        /// </summary>
        [Column(Name = "operator_type")]
        public int OperatorType { get; set; }

        /// <summary>
        ///  添加时间
        /// </summary>
        [Column(Name = "add_time")]
        public DateTime AddTime { get; set; }
    }
}